package Test;

import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class 链表递归Test {
    class ListNode{
        int val;
        ListNode next;
    }

    public static void main(String[] args) {
        Map<Integer,String> map = new HashMap<>();
        Map<Integer,String> m = new ConcurrentHashMap<>();
        map.put(1,"A");
        map.put(2,"B");
        map.put(3,"C");
        map.put(4,"D");
        map.put(5,"E");
        System.out.println(map.get(1));
        System.out.println(map.get(2));
        System.out.println(map.get(6));
        Lock lock = new ReentrantLock();
        Set<Map.Entry<Integer,String>> EntrySet = map.entrySet();
        Iterator<Map.Entry<Integer,String>> iterator = EntrySet.iterator();
        while(iterator.hasNext()) {
            Map.Entry<Integer,String> entry = iterator.next();
            System.out.println(entry.getKey()+"="+entry.getValue());
//            System.out.println(iterator.next());
        }






//        List<Integer> list = new ArrayList<>();
//        list.add(1);
//        list.add(2);
//        list.add(3);
//        list.add(4);
//        list.add(5);
//
//        int[] array = new int[]{1,2,3,4,5,6,7,8,9,10};
////        for(Integer i : array) {
////            list.remove(i);
////            System.out.println(i);
////        }
//        Iterator<Integer> iterator = list.iterator();
//        while(iterator.hasNext()) {
//            int val = iterator.next();
//            System.out.println(val);
//            iterator.remove();
//        }
        //System.out.println(sum(array));





    }
    private static int sum(int[] array) {
        return sum(0,array);
    }
    private static int sum(int i,int[] array) {
        if(i == array.length) {
            return 0;
        }
        return array[i] + sum(i+1,array);
    }
}

